<?php
/**
 * Template Name: Contact
 **/ 
get_header(); 
if(have_posts()) : while(have_posts()) : the_post(); ?>
<div class="contact-page">
    <?php
    $page_bg = get_field("background_image", get_the_ID());
    $bg_img = '';
    if(!empty($page_bg)) {
        $bg_img = 'style="background: url('.dynamic_url($page_bg['url']).') left center;background-size: 100% 100%; background-repeat: no-repeat;"';
    } 
    ?>
    <div class="container">
        <div class="content-inner" <?php echo $bg_img; ?>>
            
            <div class="map">
                <div id="map-canvas"></div>
                <div id="panel" class="contact-form">
                    <span><?php _e("Directions from:", THB_THEME_NAME); ?></span>
                    <input type="text" class="wpcf7-form-control" id="direc-start"/>
                    <button class="wpcf7-form-control wpcf7-submit" onclick="calcRoute();"><?php _e("Get directions", THB_THEME_NAME); ?></button>
                </div>
            </div>
            
            <?php /*<div class="map">
                <?php
                $map_url = get_field("map_embed_link", get_the_ID()); 
                ?>
                <iframe src="<?php echo $map_url; ?>" width="100%" height="400" frameborder="0" style="border:0"></iframe>
            </div> */ ?>
            
            <div class="main-content">
                <div class="row top-content">
                    <div class="col-xs-12">
                        <h2><?php the_title(); ?></h2>
                        <?php
                        $top_content = get_field("top_content", get_the_ID());
                        $top_content = apply_filters('the_content', $top_content);
                        echo $top_content; 
                        ?>
                    </div>
                </div>
                
                <div class="row">
                    <div class="col-sm-8">
                        <div class="contact-form">
                            <?php echo do_shortcode('[contact-form-7 id="145" title="Contact form"]');?>
                        </div>
                    </div>
                    <div class="col-sm-4">
                        <div class="content">
                            <?php the_content(); ?>
                        </div>
                    </div>
                </div>
            </div>
            
        </div>
    </div>
</div>
<?php
endwhile; endif; 
get_footer(); ?>